/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.dao.impl;

import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import thienphuc.patient.dao.AbstractHibernateDaoSupport;
import thienphuc.patient.dao.QuyenDAO;
import thienphuc.patient.dto.PhongBan;
import thienphuc.patient.dto.Quyen;

/**
 *
 * @author QuocDat
 */
public class QuyenDAOImpl extends AbstractHibernateDaoSupport<Quyen, Integer> implements QuyenDAO {

    public QuyenDAOImpl(Class<Quyen> classPersistent) {
        super(classPersistent);
    }

    public List<Quyen> findByTenQuyen(String tenQuyen) {
        Criterion criterionTenQuyen = Restrictions.like(QUYEN_TEN_QUYEN, "%" + tenQuyen + "%");
        return this.findByCriteria(criterionTenQuyen);
    }

    public List<Quyen> findByTrangThai(boolean trangThai) {
        return this.findByProperty(QUYEN_TRANG_THAI, trangThai);
    }

    public List<Quyen> findByPhongBan(PhongBan phongBan) {
        return this.findByProperty(QUYEN_PHONG_BAN, phongBan);
    }
}
